home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 8 / Eagles_Nest_Mac_Collection_Disc_8.TOAST / Developer Environments / AllegroCL11 / ccl-doc / reader.text < prev    next >
Encoding:
Text File  |  1987-08-07  |  2.7 KB  |  56 lines  |  [TEXT/CCL ]

  1. Reader Examples
  2. foo -> bar means the reader
  3. returns bar when it reads 
  4. the char sequence "foo"
  5. Use FRED c-x-c-r to see what a text region reads to.
  6. See Common Lisp the Language, Chapter 22 for details.
  7. -------------------------
  8. foo -> FOO  ;creates a symbol with print name "FOO"
  9. b\ar -> BaR ;creates a symbol, does not upper case the char following \
  10. a|bc|d -> AbcD ; creates a symbol. Does not upper case chars between 
  11.                  vertcal bars
  12. 2/3 -> the ratio two thirds.
  13. "ab" -> "ab" ;creates a string which characters a and b
  14. (a) -> (A)  ;creates a list with element A
  15. (a . b) -> (CONS A B) 
  16. 'foo -> (QUOTE foo)
  17. `foo ->  (QUOTE foo) ;called "BACKQUOTE". In this use, same as QUOTE
  18. `(,a b) -> (LIST A (QUOTE B))  ; A will get evaled by eval, but B won't
  19. `(,@c d) -> (APPEND C (QUOTE (D))) ; assumes that C evals to a list,
  20.              each element of which will appear in the list whose last 
  21.              element is D.
  22.          Ex: (setq c '(1 2))  then `(,@c d) evals to (1 2 D)
  23. ; junk  -> comment ; everything between semicolon and newline is a comment 
  24. #| junk |# -> comment ;everything between the delimiters is a comment
  25. #1=(#1#) -> a list which has as itself as its only member. 
  26.         DANGEROUS! Printing a circular list may never finish.
  27. #'foo -> (function foo) ;use instead of 'foo when passing a function as an arg.  
  28. #(a b) -> creates a simple vector with the elements A and B.
  29. #*101  -> creates a bit vector with bit elements 1, 0, and 1.
  30. #,(+ 2 3) -> 5 ; evaluates the form after comma at read and load time.
  31. #.(+ 2 3) -> 5 ;  evaluates the form after comma at read and compile time.
  32. #+foo a -> A if the symbol FOO is in the *features* list, else ignore.         
  33. #-foo a -> A if the symbol FOO is NOT in the *features* list, else ignore. 
  34. #:foo -> FOO ; creates a symbol with print name "FOO" but does not intern it.
  35. #<foo   -> Errors by design. ;use for printed representations which can't be
  36.          read back in.
  37. #\a         -> the character a .
  38. #\A         -> the character A .
  39. #\return    -> the RETURN character 
  40. Use "Char Set" item under the Help menu for other character names.
  41.  
  42. #b101 -> 5    ;treats 101 as a binary number
  43. #o101  -> 65  ;treats 101 as an octal number
  44. #x101  -> 257 ;treats 101 as a hexidecimal number
  45. #3r101 -> 10  ;treats 101 as a base 3 number. 
  46. #c(1 2) -> complex number with real part 1 and imaginary part 2
  47.  
  48. #2a((0 1 2) (10 11 12)) -> a 2-d array with 3 elements in each array
  49.                initialized to the [non-evaled] elements in the lists.
  50. #s(ship x 1 y (+ 2 3)) -> a structure of class SHIP with slot x initialized to 1
  51.                     and slot y initialized to 5. Slot values should not depend
  52.                     on lexical variables. 
  53.                     SHIP must have been previously defstructed.
  54.  
  55.  
  56.